#include <stdio.h>
#include "convex.h"
#include "bench.h"

#define N 20

point_t P[N] = 	{	{1,1},
					{2,4},
					{5,9},
					{6,13},
					{7,4},
					{8,9},
					{8,17},
					{10,2},
					{11,13},
					{12,7},
					{12,10},
					{12,16},
					{12,20},
					{13,5},
					{15,2},
					{15,8},
					{16,13},
					{16,18},
					{18,5},
					{18,8},
				};

point_t P2[N] = 	{{1,1},
					{2,2},
					{3,3},
					{4,4},
					{5,5},
					{6,6},
					{7,7},
					{8,8},
					{9,9},
					{10,10},
					{11,11},
					{12,12},
					{13,13},
					{14,14},
					{15,15},
					{16,16},
					{17,17},
					{18,18},
					{19,19},
					{20,20},
				};

point_t P3[N] = 	{{1,1},
					{2,2},
					{2,3},
					{4,5},
					{5,6},
					{6,6},
					{7,7},
					{8,9},
					{9,10},
					{10,30},
					{11,0},
					{11,12},
					{11,13},
					{11,14},
					{15,15},
					{15,16},
					{15,17},
					{20,18},
					{20,19},
					{20,20},
				};

point_t P4[N] = 	{{1,11},
					{2,9},
					{2,13},
					{4,7},
					{5,15},
					{7,5},
					{7,17},
					{11,3},
					{11,19},
					{16,1},
					{16,21},
					{21,3},
					{21,19},
					{25,5},
					{25,17},
					{28,7},
					{28,15},
					{30,9},
					{30,13},
					{31,11},
				};

point_t H[2*N];

void run_convex(void)
{
  int i=0;

  MEASURE_START();
  convex_hull(N, P4, H);
  MEASURE_STOP();
  printf("Elapsed Cycles: %lu\n", ELAPSED_CYCLES());
  printf("start: %lu, end: %lu, difference: %lu \n", start, end, start-end);
  printf("\n");

  for(i=0; i<N; i++)
  {
    printf("%i: X:%i, Y:%i \n", i, H[i].x, H[i].y);
  }
}

void run()
{
	run_convex();
}

int main(int argc, char** argv)
{
  init_benchmarks(1);
  run();
}
